import request from '@/config/axios'

export interface CopyrightVO {
  id: number
  name: string
  type: string
  contractNumber: string
  contractName: string
  copyrightSignTime: string
  projectNumber: string
  amount: string
  invoice: string
  fundSettle: string
  methName: string
  methCorp: string
  methContact: string
  methMail: string
  methAccount: string
  methAccountNumber: string
  methOpeningBank: string
  ethName: string
  ethCorp: string
  ethContact: string
  ethMail: string
  ethAccount: string
  ethAccountNumber: string
  ethOpeningBank: string
  propName: string
  propCorp: string
  propContact: string
  propMail: string
  propAccount: string
  propAccountNumber: string
  propOpeningBank: string
  validity: string
  appendix: string
  copyrightNumber: string
  copyrightValidity: string
  copyrightStatus: string
  copyrightAuthor: string
}

export interface CopyrightResource {
  id: number
  type: number
  metaId: number
  resourceId: number
  copyrightId: number
}

export interface CopyrightStages {
  id: number
  stage: string
  expires: string
  amount: string
  percentum: string
  states: string
  date: string
  parentId: number
}
export interface UpdateStatusReqVO {
  id: number
  status: number
}
// 查看版权条数
export const CopyrightCount = async (id: string) => {
  return await request.get({ url: '/copyright/count?id=' + id })
}
// 查询列表
export const getCopyrightPage = async (params: PageParam) => {
  return await request.get({ url: '/copyright/page', params })
}

// 查询非永久版权未过期列表
export const getNotExpiresCopyright = async () => {
  return await request.get({ url: '/copyright/notExpires' })
}

// 查询版权详情
export const getCopyright = async (id) => {
  return await request.get({ url: '/copyright/get?id=' + id })
}

// 新增版权
export const createCopyright = async (data: any) => {
  return await request.post({ url: '/copyright/create', data })
}

// 删除版权
export const deleteCopyright = async (id: number) => {
  return await request.delete({ url: '/copyright/delete?id=' + id })
}

// 修改版权
export const updateCopyright = async (data: any) => {
  return await request.put({ url: '/copyright/update', data })
}

// 获取版权合同阶段列表
export const getCopyrightStages = async (id: number) => {
  return await request.get({
    url: '/copyright-stages/findStagesList?id=' + id
  })
}
// 新增版权合同阶段
export const createCopyrightStages = async (data: CopyrightStages) => {
  return await request.post({ url: '/copyright-stages/createStages', data })
}

// 删除版权合同阶段
export const deleteCopyrightStages = async (id: number) => {
  return await request.delete({
    url: '/copyright-stages/delete?id=' + id
  })
}

// 获取资源信息列表
export const getCopyrightResources = async (id: number) => {
  return await request.get({
    url: '/copyright-resources/findResourcesList?id=' + id
  })
}

// 获取版权资源信息
export const getCopyrightResourcesInfo = async (id: number, type: number) => {
  return await request.get({
    url: '/copyright-resources/getCopyrightResourcesInfo?id=' + id +'&type=' + type
  })
}

// 获取图片资源信息列表
export const getPictureList = async (data: number[]) => {
  return await request.post({
    url: '/copyright-resources/findPictureList',
    data
  })
}

// 获取视频资源信息列表
export const getVideoList = async (data: number[]) => {
  return await request.post({
    url: '/copyright-resources/findVideoList',
    data
  })
}

// 获取音频资源信息列表
export const getAudioList = async (data: number[]) => {
  return await request.post({
    url: '/copyright-resources/findAudioList',
    data
  })
}

// 新增版权合同资源
export const createCopyrightResources = async (data: any) => {
  return await request.post({ url: '/copyright-resources/createResources', data })
}

// 删除版权合同资源
export const deleteCopyrightResources = async (id: number) => {
  return await request.delete({
    url: '/copyright-resources/delete?id=' + id
  })
}
/**
 * 不分片直接上传文件
 * @param data
 */
export const upload = (data) => {
  return request.upload({ url: '/copyright/upload', data: data })
}
